import { observable, action, autorun, toJS } from 'mobx';
import { WeaLocaleProvider,WeaLoadingGlobal  } from 'ecCom';
import {WeaForm, WeaTableNew} from 'comsMobx'
import {message, Button } from "antd";
import * as Apis from '../../apis/infoWord';
import { ListStore } from '../listStore';
import {Text} from '../../components/util/text';
const text = new Text();
const {TableStore} = WeaTableNew;
const getLabel = WeaLocaleProvider.getLabel;
export default class infoCreateFeedBackStore extends ListStore {
    constructor(props) {
        super(props);
    }
    @observable selectedKey = 0;
    @observable dateValue = "";
    @observable responseData = {};
    
    @observable tnjcurl = "";
    setState = (params = {}) => {
        Object.keys(params).forEach(o => {
            this.status[o] = params[o];
        })
        return this;
    }
    @action
    doHandleDate = () => {
        var myDate = new Date();
        var tYear = myDate.getFullYear();
        var tMonth = myDate.getMonth();
        var m = tMonth + 1;
        if (m.toString().length == 1) {
            m = "0" + m;
        }
        let  dateValue= tYear +'-'+ m;
        this.changeDateSelect(dateValue);
    }
    //改变日期值
    @action
    changeDateSelect=(v)=>{
        this.dateValue = v;
    }
    /**
     * 生成反馈函
     */
    @action
    createfeedback =()=>{
        const params={'date':this.dateValue};
        console.log("params",params);
        WeaLoadingGlobal.start({
            tip:<div style={{fontSize:"20px"}}>正在生成反馈函数据...<br/>窗体关闭前请勿做任何操作</div>, // 自定义tip文字
            size:'large'
          });
        Apis.infoCreateFeedBack(params).then(data=>{
            if(data.api_status == '1'){
                message.success("生成反馈函成功");
                WeaLoadingGlobal.destroy();
            }else{
                message.error("生成反馈函失败");
                WeaLoadingGlobal.destroy();
            }
        })
    }

}